package com.atguigu.service;

import com.atguigu.dao.UserDao;
import com.atguigu.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /*验证用户登录*/
    @Override
    public User checkLogin(User user) {
        User userDB = userDao.checkLogin(user);
        if (userDB==null){
            throw new RuntimeException("用户名或密码错误！");
        }
        return userDB;
    }
}
